<?php
namespace Modules\Frontend\Controllers;

class UserMutuallyBuyController extends ControllerBase {
  public function updateStatusByTokenAction($id, $status) {
    return $this -> returnByJson($this -> user -> getSharedFactory() -> getFacade('Mutually\\Buy') -> updateStatusByToken(
      $this -> request -> getQuery('token', 'string', null, true),
      $id,
      $status,
      $this -> request -> getPut()
    ));
  }

  public function updateResetMatchByTokenAction($id) {
    return $this -> returnByJson($this -> user -> getSharedFactory() -> getFacade('Mutually\\Buy') -> updateResetMatchByToken(
      $this -> request -> getQuery('token', 'string', null, true),
      $id
    ));
  }

  public function findFirstByIdAndTokenAction($id) {
    return $this -> returnByJson($this -> user -> getSharedFactory() -> getFacade('Mutually\\Buy') -> findFirstByIdAndToken($id, $this -> request -> getQuery('token', 'string', null, true)));
  }

  public function pagerByTokenAction() {
    return $this -> returnByJson($this -> user -> getSharedFactory() -> getFacade('Mutually\\Buy') -> pagerByToken(
      $this -> request -> getQuery('token', 'string', null, true),
      $this -> request -> getQuery())
    );
  }

  public function createByTokenAction() {
    return $this -> returnByJson($this -> user -> getSharedFactory() -> getFacade('Mutually\\Buy') -> createByTokenAndField(
      \Components\User\Sha\Wallet\Constants::STATIC1,
      $this -> request -> getQuery('token', 'string', null, true),
      $this -> request -> getPost()
    ));
  }
}
